package com.jack.lib.core.log

import com.blankj.utilcode.util.TimeUtils
import com.elvishew.xlog.LogLevel
import com.elvishew.xlog.flattener.Flattener
import com.elvishew.xlog.flattener.Flattener2

/**
 * author : chong.huang
 * create : 2022/3/16
 * desc   :
 */
class LogFlattener : Flattener, Flattener2 {

    override fun flatten(logLevel: Int, tag: String?, message: String?): CharSequence {
        return flatten(System.currentTimeMillis(), logLevel, tag, message)
    }

    override fun flatten(timeMillis: Long, logLevel: Int, tag: String?, message: String?): CharSequence {
        return (TimeUtils.millis2String(timeMillis, "HH:mm:ss.SSS")
                + " " + LogLevel.getShortLevelName(logLevel)
                + "/" + tag
                + ": " + message)
    }
}